﻿using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System;
using System.Reflection;

public class TextLocalization : MonoBehaviour {
	/*文本对应的属性名，首字母大写*/
	public string textName;

	void TextLocalizationChange()
	{
		/*使用反射， 通过textName获取属性值*/
		Type t = Localization.Instance.GetType();
		PropertyInfo property = t.GetProperty (textName);
		if (null != property )
		{
			Debug.Log(property.GetValue (Localization.Instance, null).ToString ());
			this.GetComponent<Text> ().text = property.GetValue (Localization.Instance, null).ToString ();
		}
	}

	void Start()
	{
		TextLocalizationChange ();
	}
}
